<style>
	select{
		padding:2px 3px 2px 3px;
	}
</style>
<SCRIPT LANGUAGE="JavaScript"> 
    function tampil() {
        $("#hint").fadeIn("fast");
    }
    function sembunyi() {
        $("#hint").fadeOut("slow");
    }

    function validation()
    {
        if( document.getElementById('AssistantSalary').value.length!=0 && isNaN(document.getElementById('AssistantSalary').value) )
        {
            document.getElementById('AssistantSalary').focus();
            document.getElementById('AssistantSalary').style.backgroundColor='#FF9';
            alert("Please fill your salary with numeric charackters");
            document.getElementById('AssistantSalary').style.backgroundColor='#FFF';
            return false;
        }    
        if( document.getElementById('AssistantSalary').value<0 )
        {
            document.getElementById('AssistantSalary').focus();
            document.getElementById('AssistantSalary').style.backgroundColor='#FF9';
            alert("Please fill your salary with positive value");
            document.getElementById('AssistantSalary').style.backgroundColor='#FFF';
            return false;
        }
        
        var maxxx=3;
        pilih = 0;
        c=0;
        for( c = 0; c<document.getElementById('CityCity').length; c+=1) 
        {
            if(document.getElementById('CityCity')[c].selected)
            {
                pilih=pilih+1;
            }    
        }                     

        if (pilih ==0)
        {
            alert('Sorry, you must choose the the location city of the job');
            return false;        
        }
        
        if (pilih > maxxx)
        {
            alert('Sorry, you can choose the location city more than '+maxxx);
            return false;        
        }         

        var pilih = 0;
        var c=0;
        for( c = 0; c<document.getElementById('FieldField').length; c+=1) 
        {
            if(document.getElementById('FieldField')[c].selected)
            {
                pilih=pilih+1;
            }    
        }                     

        if (pilih ==0)
        {
            alert('Sorry, you must choose the type of fields');
            return false;        
        }
        
        if (pilih > maxxx)
        {
            alert('Sorry, you can choose the type of fields more than '+maxxx);
            return false;        
        }

    }    
    
</SCRIPT>

<?php 
e($javascript->link('jquery.js')); 
echo "<div class='form'>";
    echo "<h2> Profil Asistensi Saya </h2>";
    echo "<hr color='#2A7EF7'>";
    echo ":. &nbsp Lihat semua pekerjaan yang direkomendasikan yang cocok untuk profil asisten Anda ".$html->link('[ Here ]',array('controller'=>'assistants','action'=>'result'));
    echo "<div class='kotak'>";
    echo $form->create('Assistant',array('action'=>'index','onsubmit'=>'return validation();'));
    
    echo "<div class='input'><label> &nbsp </label><label> &nbsp </label><label> &nbsp </label>";
    echo " &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <img src='img/hint.gif' onmouseover='tampil();' onmouseout='sembunyi();'>";
    echo "</div>";
        echo $form->input('id', array('type'=>'hidden'));
        echo $form->input('jobseeker_id', array('type'=>'hidden'));
        // echo $form->input('keywords',array('size'=>'40'));
        // echo $form->input('academic_id',array('label'=>'Qualification'));
        // echo $form->input('experience',array('label'=>'Working Experience','size'=>'2','after'=>' year(s)'));
         echo "<div class='input'>";
		echo $form->input('salary', array('div'=>false,'label'=>'Diharapkan minimal gaji'));
        echo "&nbsp;" . $form->input('negotiable', array('div'=>false,'after'=>' Sertakan gaji dinegosiasikan','label'=>false));
		echo "</div>";
        echo "<div class='input'>";
       /*  echo "<label>Type of work</label>";
        echo "</div>";
        echo $form->input('parttime', array('div'=>false,'label'=>'Part Time', 'between'=>' '))." &nbsp";
        echo $form->input('fulltime', array('div'=>false,'label'=>'Full Time' ,'between'=>' '))." &nbsp";
        echo $form->input('freelance', array('div'=>false,'between'=>' '))." &nbsp";
        echo $form->input('contract', array('div'=>false,'between'=>' '))." &nbsp";
        echo $form->input('temporary', array('div'=>false,'between'=>' ')); */
        
        echo "<div class='input'>";
       /*  echo "<label>Career Level</label>";
        echo "</div>";
        echo $form->input('entry', array('div'=>false, 'between'=>' '))." &nbsp";
        echo $form->input('middle', array('div'=>false, 'between'=>' '))." &nbsp";
        echo $form->input('senior', array('div'=>false, 'between'=>' '))." &nbsp";
        echo $form->input('top', array('div'=>false, 'between'=>' ')); */
        
        echo "<div class='input'>";
            echo "<label> &nbsp  </label>";
            echo "<table>";
            echo "<tr><th>Kota<span class='red'>*</span></th><th>Kategori<span class='red'>*</span></th></tr>";
            echo "<tr><td>".$form->input('City',array('label'=>false,'style'=>'height:120px;width:180px'));
            echo "</td><td>".$form->input('Field',array('label'=>false,'style'=>'height:120px;width:200px'))."</td></tr>";
            echo "</table>";
        echo "</div>";
        // $options[0] = 'No';
        // $options[1] = 'Yes';
        // echo $form->input('email', array('label'=>'Pemberitahuan lewat Email','options'=>$options));
		$result = mysql_fetch_array(mysql_query("SELECT * FROM assistant_priorities WHERE assistant_id=" . $this->data['Assistant']['id'] ." AND type=" . 1 . ""));
        ?>
		<div class="input">
			<label>Priority</label>
			<table>
				<tr>
					<td>Salary</td>
					<td>
						<select name="salary" onchange="ubah(this)" id="salary">
							<option value="">-Prioritas Gaji-</option>
							<option value="1" <?php echo ($result["priority"] == 1) ? ("selected") : (""); ?>>Not Important</option>
							<option value="2" <?php echo ($result["priority"] == 2) ? ("selected") : (""); ?>>Important</option>
							<option value="3" <?php echo ($result["priority"] == 3) ? ("selected") : (""); ?>>Very Important</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>Skill</td>
					<?php
					$result = mysql_fetch_array(mysql_query("SELECT * FROM assistant_priorities WHERE assistant_id=" . $this->data['Assistant']['id'] ." AND type=" . 2 . ""));
					?>
					<td>
						<select name="skill" onchange="ubah(this)" id="skill">
							<option value="">-Prioritas Kemampuan-</option>
							<option value="1" <?php echo ($result["priority"] == 1) ? ("selected") : (""); ?>>Not Important</option>
							<option value="2" <?php echo ($result["priority"] == 2) ? ("selected") : (""); ?>>Important</option>
							<option value="3" <?php echo ($result["priority"] == 3) ? ("selected") : (""); ?>>Very Important</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>Reputation</td>
					<?php
					$result = mysql_fetch_array(mysql_query("SELECT * FROM assistant_priorities WHERE assistant_id=" . $this->data['Assistant']['id'] ." AND type=" . 3 . ""));
					?>
					<td>
						<select name="reputation" onchange="ubah(this)" id="reputation">
							<option value="">-Prioritas Reputasi-</option>
							<option value="1" <?php echo ($result["priority"] == 1) ? ("selected") : (""); ?>>Not Important</option>
							<option value="2" <?php echo ($result["priority"] == 2) ? ("selected") : (""); ?>>Important</option>
							<option value="3" <?php echo ($result["priority"] == 3) ? ("selected") : (""); ?>>Very Important</option>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<?php
        echo "<div class='input'>";
            echo "<label> &nbsp  </label>";
            echo "<input type='submit' value='Save'>";
        echo "</div>";
    echo "</form>";    
        
    echo "</div>";
    echo ":. <span class='red'>*</span> Required Field";
    echo "<br>:. &nbsp In <b>City</b> and <b>Category</b> field, silakan pilih minimal 1 pilihan dan maksimal 3 pilihan";
    
    $word = "<b>Keyword(s) Tip</b><br>&nbsp - Fill blank if you don't care <br>&nbsp - Only for one word or pharse";
    $word .= "<br><b>Qualification Tip</b><br>&nbsp - Search method is from below until, so choose your highest education ";
    $word .= "<br><b>Working Experience Tip</b><br>&nbsp - Search method is from below until ";
    $word .= "<br><b>Expected Salary Tip</b><br>&nbsp - Search method is above, so choose your minimum expected salary<br>&nbsp - For including any jobs with negotiable salary, checked the Negotiable field";
    $word .= "<br><b>Type of Work Tip</b><br>&nbsp - Search method is OR <br>&nbsp - Fill balnk if you want including any jobs with all category type of work";
    $word .= "<br><b>Career Level Tip</b><br>&nbsp - Search method is OR <br>&nbsp - Fill balnk if you want including any level jobs ";
    
echo "<div id='hint' style='top:290px;left:808px;width:370px;display:none;position:absolute'>".$word."</div>";     
echo "</div>";
?>
<script language="javascript">
	$("#salary").change(function (){
		if($("#salary").val() == 1){
			$("#skill option[value='1']").hide();
			$("#reputation option[value='1']").hide();
			$("#skill option[value='2']").show();
			$("#reputation option[value='2']").show();
			$("#skill option[value='3']").show();
			$("#reputation option[value='3']").show();
		} else if($("#salary").val() == 2){
			$("#skill option[value='1']").show();
			$("#reputation option[value='1']").show();
			$("#skill option[value='3']").show();
			$("#reputation option[value='3']").show();
			$("#skill option[value='2']").hide();
			$("#reputation option[value='2']").hide();
		} else if($("#salary").val() == 3){
			$("#skill option[value='3']").hide();
			$("#reputation option[value='3']").hide();
			$("#skill option[value='1']").show();
			$("#reputation option[value='1']").show();
			$("#skill option[value='2']").show();
			$("#reputation option[value='2']").show();
		} else {
			$("#skill option[value='3']").show();
			$("#reputation option[value='3']").show();
			$("#skill option[value='1']").show();
			$("#reputation option[value='1']").show();
			$("#skill option[value='2']").show();
			$("#reputation option[value='2']").show();
		}
	});
</script>